/**
 * getRolesByTree
 * @returns
 */
import {request} from "@/core/AxiosConfig";

export const RoleApi = {
    getRolesByTree: () => {
        return request.get(`/role/tree`);
    },
    /**
     * addRole
     * @param {object} params KaSecurityRoleAddRole
     * @param {string} params.userRole
     * @param {string} params.roleName
     * @param {number} params.fid
     * @returns
     */
    addRole: (params) => {
        return request.post(`/role/`, params);
    },
    /**
     * updateRole
     * @param {object} params KaSecurityRoleUpdateRole
     * @param {number} params.id
     * @param {string} params.fUserRole
     * @param {string} params.userRole
     * @param {string} params.roleName
     * @param {number} params.fid
     * @returns
     */
    updateRole:(params)=>{
        return request.put(`/role`, params);
    },

    /**
     * delete_1
     * @param {string} id
     * @returns
     */
    delete: (id) => {
        return request.delete(`/role?id=${id}`);
    }
}